<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<header th:fragment="header">
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="nav-info">
            <a class="navbar-brand" href="#">笔记本电脑购物商城</a>
            <div th:if="${username} != null">
                <a th:text="${username}" class="nav-link"></a>
                <a th:href="@{/user/logout}" class="nav-link">登出</a>
            </div>
            <div th:if="${username} == null">
                <a th:href="@{/login}" class="nav-link">登录</a>
                <a th:href="@{/register}" class="nav-link">注册</a>
            </div>
        </div>
    </nav>
    <ul class="menu">
        <li><a href="">首页</a></li>
        <li><a th:href="@{/cart}">购物车</a></li>
        <li><a href=""></a></li>
    </ul>
</header>

</body>
</html>